]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Don't ever force reload
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 12 Dec 2013 00:58:42 +0000 (19:58 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 16 Dec 2013 17:44:22 +0000 (12:44 -0500)
https://bugzilla.gnome.org/show_bug.cgi?id=720298

js/ui/calendar.js
js/ui/dateMenu.js

index d91578319f4d9d669e1fda92d6d20cd67c174f70..836e89868bb205c0dade9d656bc6c5d1e3dc50fd 100644 (file)
@@ -329,25 +329,22 @@ const DBusEventSource = new Lang.Class({
             return;
 
         if (this._curRequestBegin && this._curRequestEnd){
-            let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
-            if (forceReload)
-                callFlags = Gio.DBusCallFlags.NONE;
             this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
                                             this._curRequestEnd.getTime() / 1000,
                                             forceReload,
                                             Lang.bind(this, this._onEventsReceived),
-                                            callFlags);
+                                            Gio.DBusCallFlags.NONE);
         }
     },
 
-    requestRange: function(begin, end, forceReload) {
-        if (forceReload || !(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
+    requestRange: function(begin, end) {
+        if (!(_datesEqual(begin, this._lastRequestBegin) && _datesEqual(end, this._lastRequestEnd))) {
             this.isLoading = true;
             this._lastRequestBegin = begin;
             this._lastRequestEnd = end;
             this._curRequestBegin = begin;
             this._curRequestEnd = end;
-            this._loadEvents(forceReload);
+            this._loadEvents(false);
         }
     },
 
@@ -419,21 +416,19 @@ const Calendar = new Lang.Class({
     setEventSource: function(eventSource) {
         this._eventSource = eventSource;
         this._eventSource.connect('changed', Lang.bind(this, function() {
-            this._update(false);
+            this._update();
         }));
-        this._update(true);
+        this._update();
     },
 
     // Sets the calendar to show a specific date
-    setDate: function(date, forceReload) {
-        if (!_sameDay(date, this._selectedDate)) {
-            this._selectedDate = date;
-            this._update(forceReload);
-            this.emit('selected-date-changed', new Date(this._selectedDate));
-        } else {
-            if (forceReload)
-                this._update(forceReload);
-        }
+    setDate: function(date) {
+        if (_sameDay(date, this._selectedDate))
+            return;
+
+        this._selectedDate = date;
+        this._update();
+        this.emit('selected-date-changed', new Date(this._selectedDate));
     },
 
     _buildHeader: function() {
@@ -521,7 +516,7 @@ const Calendar = new Lang.Class({
 
         this._backButton.grab_key_focus();
 
-        this.setDate(newDate, false);
+        this.setDate(newDate);
     },
 
     _onNextMonthButtonClicked: function() {
@@ -545,16 +540,16 @@ const Calendar = new Lang.Class({
 
         this._forwardButton.grab_key_focus();
 
-        this.setDate(newDate, false);
+        this.setDate(newDate);
     },
 
     _onSettingsChange: function() {
         this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY);
         this._buildHeader();
-        this._update(false);
+        this._update();
     },
 
-    _update: function(forceReload) {
+    _update: function() {
         let now = new Date();
 
         if (_sameYear(this._selectedDate, now))
@@ -614,7 +609,7 @@ const Calendar = new Lang.Class({
                 this._shouldDateGrabFocus = true;
 
                 let newlySelectedDate = new Date(iterStr);
-                this.setDate(newlySelectedDate, false);
+                this.setDate(newlySelectedDate);
 
                 this._shouldDateGrabFocus = false;
             }));
@@ -671,7 +666,7 @@ const Calendar = new Lang.Class({
         }
         // Signal to the event source that we are interested in events
         // only from this date range
-        this._eventSource.requestRange(beginDate, iter, forceReload);
+        this._eventSource.requestRange(beginDate, iter);
     }
 });
 
index bd72a665cd3032689f74f9d49e0edabf01f3a5a7..d851ed2bd1619714aaaf7bd648a64b0816eeefb4 100644 (file)
@@ -113,22 +113,7 @@ const DateMenuButton = new Lang.Class({
         this.menu.connect('open-state-changed', Lang.bind(this, function(menu, isOpen) {
             if (isOpen) {
                 let now = new Date();
-                /* Passing true to setDate() forces events to be reloaded. We
-                 * want this behavior, because
-                 *
-                 *   o It will cause activation of the calendar server which is
-                 *     useful if it has crashed
-                 *
-                 *   o It will cause the calendar server to reload events which
-                 *     is useful if dynamic updates are not supported or not
-                 *     properly working
-                 *
-                 * Since this only happens when the menu is opened, the cost
-                 * isn't very big.
-                 */
-                this._calendar.setDate(now, true);
-                // No need to update this._eventList as ::selected-date-changed
-                // signal will fire
+                this._calendar.setDate(now);
             }
         }));